package com.api.regression.group.downloaddocumentversion;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IGroupApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/group/group-upload.xml" })
public class DownloadDocumentVersionPrivateGroup extends AbstractApiTest {

	@Value("#{group_privateToDownload[participant].appId}")
	private String userUrn;

	@Value("#{group_privateToDownload[participant].password}")
	private String userPassword;

	@Value("#{group_privateToDownload.urn}")
	private String groupUrn;

	@Value("#{group_privateToDownload.documentUrn}")
	private String groupDocumentUrn;

	@Value("#{group_privateToDownload.documentVersionUrn}")
	private String documentVersionUrn;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test
	public void testDownloadDocument() throws ZyncroApiException {

		getApi().getService(IGroupApiService.class).downloadDocumentVersion(groupUrn, groupDocumentUrn, documentVersionUrn,
				getApi().getAccessKey());
	}
}
